function isSymmetric(root: TreeNode | null): boolean {
  if (root === null) return true;

  const traverser = (
    left: TreeNode | null,
    right: TreeNode | null
  ): boolean => {
    if (left !== null && right !== null) {
      const leftResult = traverser(left.left, right.right);
      const rightResult = traverser(left.right, right.left);

      return left.val === right.val && leftResult && rightResult;
    }

    return left === right;
  };

  return traverser(root.left, root.right);
}
export {};
